package com.ruoyi.common.core.domain;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.common.core.domain.entity.CustomerClass;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysMenu;
import lombok.Data;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Treeselect树结构实体类
 *
 * @author ruoyi
 */
@Data
public class TreeSelectString implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 节点ID
     */
    private String  id;

    /**
     * 节点名称
     */
    private String label;

    /**
     * 子节点
     */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<TreeSelectString> children;

    public TreeSelectString() {

    }


    public TreeSelectString(CustomerClass customerClass) {
        this.id = customerClass.getCcccode();
        this.label = customerClass.getCccname();
        this.children = customerClass.getChildren().stream().map(TreeSelectString::new).collect(Collectors.toList());
    }





}
